home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2010 Summer - Disc 1 / WN_Ete2010_CD1.iso / Onglet5 / Weezo / Weezo setup.exe / {code_appDir} / www / res / administration / config / password.php < prev    next >
PHP Script  |  2010-05-19  |  6KB  |  154 lines

  1. <?php
  2. /**
  3.  * Accounts remote configuration
  4.  *
  5.  * PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12. *
  13.  * @category   NA
  14.  * @package    NA
  15.  * @author     Nicolas Bruley / Peer 2 World <contact@weezo.net>
  16.  * @copyright  2005-2009 Nicolas Bruley / Peer 2 World
  17.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  18.  * @version    CVS: $Id:$
  19.  * @link       http://www.weezo.net
  20.  * @since      File available since Release 2.0.0
  21.  */
  22.  
  23.  
  24. require(INCLUDE_DIR.'outputFunctions.php');
  25.  
  26. if(cfUGetVar('accountType')!='singleUser') die('unauthorized access');
  27.  
  28.  
  29. /*
  30.  ***************************************************************************************************************************
  31.  * Process POST commands
  32.  ***************************************************************************************************************************
  33.  */
  34. if(isset($_POST['cPwds'])){
  35.     $plainText=cfRSADecrypt($_POST['cPwds']);
  36.     if(strpos($plainText,'/new:') && cfCmpLeft($plainText,'prev:')){
  37.         $prev=substr($plainText,5,strpos($plainText,'/new:')-5);
  38.         if(cfUGetVar('authenticationMethod')=='password' && md5($prev)!=cfUGetVar('password')){
  39.             $errorMessage=cfCaption('loginBadPassword');
  40.         }
  41.         else{
  42.             $new=substr($plainText,strpos($plainText,'/new:')+5);
  43.             if(strlen($new)>0){
  44.                 require_once(INCLUDE_DIR.'resourceConfigFunctions.php');
  45.                 rcUserSaveValues(array('authenticationMethod'=>'password', 'password'=>md5($new)));
  46.                 cfUSetVar('authenticationMethod','password');
  47.                 cfUSetVar('password',md5($new));
  48.                 cfInsertHEAD();
  49.                 ?>
  50. <body>
  51. <?php echo outDivFrame('frame1');?>
  52. <div class="frame1Header"><?php echo cfCaption('genPasswordNew');?></div>
  53. <br><br><br>
  54. <center>
  55. <?php echo cfCaption('passwordChanged');?>
  56. </center>
  57. <br><br>
  58. <center>
  59. <?php echo outButton(cfCaption('genClose'),'javascript:winMe.closeMe()',outIcon('close'));?>
  60. <?php echo outKeyHandler('D',array('27'=>'winMe.closeMe()','13'=>'winMe.closeMe()'),true)?>
  61. </center>
  62. </div>
  63. </body>
  64.                 <?php
  65.                 exit;
  66.             }
  67.         }
  68.     }
  69. }
  70.  
  71.  
  72. /*
  73.  ***************************************************************************************************************************
  74.  * Display page
  75.  ***************************************************************************************************************************
  76.  */
  77. cfInsertHEAD(false);
  78. echo outRSAScripts();
  79. ?>
  80. <script type="text/javascript">
  81. function togglePwdShow(){
  82.     if(dgi("showPwd").checked){
  83.         dgi("newConfTd").style.visibility="hidden";
  84.         try{dgi("new").type="text"}catch(e){dgi("new").outerHTML='<input type="text" id="new" value="'+dgi("new").value+'">'}
  85.         dgi("prev").style.width="100%";
  86.     }
  87.     else{
  88.         dgi("newConfTd").style.visibility="";
  89.         try{dgi("new").type="password"}catch(e){dgi("new").outerHTML='<input type="password" id="new" value="'+dgi("new").value+'">'}
  90.         dgi("prev").style.width="100%";
  91.     }
  92.     val();
  93. }
  94. function togglePwdShowClick(){
  95.     dgi("showPwd").checked=!dgi("showPwd").checked;
  96.     togglePwdShow();
  97. }
  98. function init(){
  99.     dgi("prev").focus();
  100.     winMe.resizeInnerTo(0,actualOffsetBottom(dgi("mainFrame"))+10);
  101.     winMe.freezeSize();
  102. }
  103. function val(){
  104.     var v=1;
  105.     if(!dgi("prev").value) v=0;
  106.     if(!dgi("new").value) v=0;
  107.     if((!dgi("showPwd").checked) && dgi("new").value!=dgi("newConf").value) v=0;
  108.     if(v) wl.button.enable("goBt"); else wl.button.disable("goBt");
  109.     return v;
  110. }
  111. function go(){
  112.     RSACrypt('prev:'+dgi('prev').value+'/new:'+dgi('new').value,goProceed,dgi("progress"));
  113. }
  114. function goProceed(c){
  115.     dgn("cPwds").value=c;
  116.     dgi("cPwdsForm").submit();
  117. }
  118. </script>
  119. </head>
  120. <body onload="init()">
  121. <?php echo outDivFrame('frame1','id="mainFrame"');
  122. echo outFrameHeaderTable('frame1Header',cfCaption('genPasswordNew'),'<span id="progress"> </span>');
  123.  
  124. echo outTableTransparent();
  125. echo '<tr><td style="width:50%;white-space:nowrap">'.cfCaption('passwordCurrent').'   </td><td><input type="password" id="prev" name="prev" style="width:100%"></td></tr>';
  126. echo '<tr><td style="width:50%;white-space:nowrap">'.cfCaption('passwordNew').'   </td><td><input type="password" id="new" name="prevConf" style="width:100%"></td></tr>';
  127. echo '<tr id="newConfTd"><td style="width:50%;white-space:nowrap">'.cfCaption('genConfirm').'   </td><td><input type="password" id="newConf" name="newConf" style="width:100%"></td></tr>';
  128. echo '<tr><td colspan="2" style="text-align:right"><input type="checkbox" id="showPwd" onclick="togglePwdShow()"> <span onclick="togglePwdShowClick()">'.cfCaption('passwordShow').'</span></td></tr>';
  129. ?>
  130. </table>
  131. <form method="POST" enctype="multipart/form-data" style="display:none" id="cPwdsForm">
  132. <input name="cPwds">
  133. </form>
  134. <center>
  135. <?php
  136. echo '<div class="warning">'.((isset($errorMessage))?$errorMessage:' ').'</div>';
  137. echo outButton(cfCaption('explorerAudioApply'),'javascript:go()',outIcon('ok'),false,'goBt',false,false,true);
  138. echo outButton(cfCaption('genCancel'),'javascript:winMe.closeMe()',outIcon('cancel'));
  139. ?>
  140. </center>
  141. <script type="text/javascript">
  142. dgi("prev").onkeyup=function (e){val();if(wl.eventKC(e)==13) dgi("new").focus()}
  143. dgi("new").onkeyup=function (e){
  144.     if(wl.eventKC(e)==13) {
  145.         if(dgi("showPwd").checked && val()) go();
  146.         if(!dgi("showPwd").checked) dgi("newConf").focus();
  147.     }
  148.     else val();
  149. }
  150. dgi("newConf").onkeyup=function (e){if(val()&&wl.eventKC(e)==13) go()}
  151. <?php echo outKeyHandler('D',array('27'=>'winMe.closeMe()'));?>
  152. </script>
  153. </div>
  154. </body>